package com.example.object.screen;

import android.content.Context;
import android.util.Log;

import com.example.globject.GLSquare;
import com.example.object.GameShape;
import com.example.state.AppState;

/**
 * Created by Lucas on 26/06/13.
 */
public class Background extends GameShape {

    /**
     * The glObject of the background
     */
    private GLSquare _glSquare;
    /**
     * The debug TAG
     */
    private final String TAG = "LockerShape";

    /**
     * The constructor
     * @param context the context of the application
     * @param midHeight the height of the background
     * @param imgBackground the id of the image resource
     */
    public Background(Context context, float midHeight, int imgBackground){
        Log.i(TAG, "Background constructor");
        _handlerInitiate = false;
        _userData = AppState.NULL;
        _glSquare = new GLSquare(context, midHeight, 1f, midHeight, 1f, imgBackground);
    }

    /**
     * set the handler of the matrix and other id
     * @param positionHandle
     * @param textureHandle
     * @param MVPMatrixHandle
     * @param vMatrix
     * @param projMatrix
     */
    public void setGLHandler(int positionHandle, int textureHandle, int MVPMatrixHandle,
                             float vMatrix[], float projMatrix[]){
        _glSquare.setGLHandler(positionHandle,textureHandle,MVPMatrixHandle,vMatrix,projMatrix, null);
        _handlerInitiate = true;
    }

    @Override
    public void draw(){
        _glSquare.draw();
    }


    public String toString(){
        return "glSquare: " + _glSquare.toString();
    }

    public GLSquare getGLSquare(){
        return _glSquare;
    }
}
